import 'package:flutter/material.dart';

void main() {
  // 1.运行应用程序
  runApp(const MaterialApp(home: Main()));
}

class Main extends StatelessWidget {
  const Main({super.key});

  @override
  Widget build(BuildContext context) {
    // 2.构建应用程序界面
    return Scaffold(
      appBar: AppBar(
        title: const Text(
          '案例-商品订单信息',
          style: TextStyle(color: Colors.white),
        ),
        backgroundColor: Colors.black,
      ),
      // 中间内容
      body: Container(
        padding: const EdgeInsets.all(10),
        color: Colors.black12,
        child: Column(
          children: [
            // yi
            const Row(
              // 主轴对齐方式：两边对齐
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Text('2024-08-15 21:49:48'),
                Text(
                  '代发货',
                  style: TextStyle(color: Colors.amber),
                ),
              ],
            ),
            const SizedBox(height: 10), // 充当 margin 角色
            // er
            Row(
              // 纵轴对齐方式：从上到下
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Image.network(
                  'https://yanxuan-item.nosdn.127.net/a09de222ed32efa8ffe359b1d5780574.jpg',
                  height: 100,
                  width: 100,
                ),
                const SizedBox(
                  width: 10,
                ), // 充当 margin 角色
                Expanded(
                  child: SizedBox(
                    height: 100,
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        const Text(
                          '茶水分离杯耐热隔热玻璃杯茶水分离杯耐热隔热玻璃杯茶水分离杯耐热隔热玻璃杯茶水分离杯耐热隔热玻璃杯',
                          maxLines: 2,
                          overflow: TextOverflow.ellipsis,
                        ),
                        Container(
                          padding: const EdgeInsets.symmetric(
                              vertical: 2, horizontal: 5),
                          decoration: BoxDecoration(
                              color: Colors.white54,
                              borderRadius: BorderRadius.circular(5)),
                          child: const Text(
                            '规格:白色240ml',
                            style: TextStyle(
                              color: Colors.grey,
                            ),
                          ),
                        ),
                        const Text('¥119.5'),
                      ],
                    ),
                  ),
                ),
                const Text(
                  'x2',
                  style: TextStyle(height: 3),
                )
              ],
            ),
          ],
        ),
      ),
    );
  }
}
